<?php
include "connection.php";$i=0;
$username=$_GET['username'];
$id=$_GET['id'];
$year=$_GET['year'];
if($year==2010)
{
$result=mysql_query("SELECT * FROM pk14_dering_masyarakat_2010 where sd_7_1='$username' AND id='$id'");
}
else if($year==2011)
{
$result=mysql_query(" SELECT * FROM pk14_dering_masyarakat_2011 where sd_7_1='$username' AND id='$id'");

}
else if($year==2012)
{

$result=mysql_query("SELECT * FROM pk14_dering_masyarakat_2012 where sd_7_1='$username' AND id='$id'");

}
else if($year==2013)
{
$result=mysql_query("SELECT * FROM pk14_dering_masyarakat_2013 where sd_6_1='$username' AND id='$id'");

}
if(mysql_num_rows($result))
{
while ($row = mysql_fetch_object($result)) 
		{
				$arr[$i]=array("year"=>'2010',"id"=>$row->id,"desa_1_1"=>$row->sd_1_1,"desa_1_2"=>$row->sd_1_2,"desa_1_3"=>$row->sd_1_3,"desa_1_4"=>$row->sd_1_4,"desa_1_5"=>$row->sd_1_5,"desa_1_6"=>$row->sd_1_6,"desa_2_1"=>$row->sd_2_1,"desa_2_2"=>$row->sd_2_2,"desa_2_3"=>$row->sd_2_3,"desa_2_4"=>$row->sd_2_4,"desa_2_5"=>$row->sd_2_5,"desa_2_6a"=>$row->sd_2_6a,"desa_2_6b"=>$row->sd_2_6b,"desa_3_1a"=>$row->sd_3_1a,"desa_3_1b"=>$row->sd_3_1b,"desa_3_211"=>$row->sd_3_211,"desa_3_212"=>$row->sd_3_212,"desa_3_213"=>$row->sd_3_213,"desa_3_214"=>$row->sd_3_214,"desa_3_215"=>$row->sd_3_215,"desa_3_221"=>$row->sd_3_221,"desa_3_222"=>$row->sd_3_222,"desa_3_223"=>$row->sd_3_223,"desa_2_224"=>$row->sd_3_224,"desa_2_225"=>$row->sd_3_225,"desa_3_231"=>$row->sd_3_231,"desa_3_232"=>$row->sd_3_232,"desa_3_233"=>$row->sd_3_233,"desa_3_234"=>$row->sd_3_234,"desa_3_235"=>$row->sd_3_235,"desa_3_3"=>$row->sd_3_3,"desa_3_4"=>$row->sd_3_4,"desa_3_5a"=>$row->sd_3_5a,"desa_3_5b"=>$row->sd_3_5b,"desa_3_5c"=>$row->sd_3_5c,"desa_3_5d"=>$row->sd_3_5d,"desa_4_1"=>$row->sd_4_1,"desa_4_2"=>$row->sd_4_2,"desa_4_3"=>$row->sd_4_3,"desa_4_4"=>$row->sd_4_4,"desa_4_5"=>$row->sd_4_5,"desa_4_6"=>$row->sd_4_6,"desa_4_7"=>$row->sd_4_7,"desa_4_8"=>$row->sd_4_8,"desa_4_9a"=>$row->sd_4_9a,"desa_4_9b"=>$row->sd_4_9b,"desa_4_9c"=>$row->sd_4_9c,"desa_4_10"=>$row->sd_4_10,"desa_4_11a"=>$row->sd_4_11a,"desa_4_11b"=>$row->sd_4_11b,"desa_4_12a"=>$row->sd_4_12a,"desa_4_12b"=>$row->sd_4_12b,"desa_4_13"=>$row->sd_4_13,"desa_4_14a"=>$row->sd_4_14a,"desa_4_14b"=>$row->sd_4_14b,"desa_4_15"=>$row->sd_4_15,"desa_4_16"=>$row->sd_4_16,"desa_4_17"=>$row->sd_4_17,"desa_4_18"=>$row->sd_4_18,"desa_4_19a"=>$row->sd_4_19a,"desa_4_19b"=>$row->sd_4_19b,"desa_4_20a"=>$row->sd_4_20a,"desa_4_20b"=>$row->sd_4_20b,"desa_4_20c"=>$row->sd_4_20c,"desa_4_20d"=>$row->sd_4_20d,"desa_5_1"=>$row->sd_5_1,"desa_5_2"=>$row->sd_5_2,"desa_5_3"=>$row->sd_5_3,"desa_5_4"=>$row->sd_5_4,"desa_5_5a"=>$row->sd_5_5a,"desa_5_5b"=>$row->sd_5_5b,"desa_5_5c"=>$row->sd_5_5c,"desa_5_5d"=>$row->sd_5_5d,"desa_5_6"=>$row->sd_5_6,"desa_5_7a"=>$row->sd_5_7a,"desa_5_7b"=>$row->sd_5_7b,"desa_5_8"=>$row->sd_5_8,"desa_5_9a"=>$row->sd_5_9a,"desa_5_9b"=>$row->sd_5_9b,"desa_5_9c"=>$row->sd_5_9c,"desa_5_9d"=>$row->sd_5_9d,"desa_5_10"=>$row->sd_5_10,"desa_5_11"=>$row->sd_5_11,"desa_5_12"=>$row->sd_5_12,"desa_5_13a"=>$row->sd_5_13a,"desa_5_13b"=>$row->sd_5_13b,"desa_6_1"=>$row->sd_6_1,"desa_6_2"=>$row->sd_6_2,"desa_6_3"=>$row->sd_6_3,"desa_7_1"=>$row->sd_7_1,"desa_7_2"=>$row->sd_7_2,"desa_7_3"=>$row->sd_7_3,"desa_7_4"=>$row->sd_7_4,"desa_7_5"=>$row->sd_7_5,"desa_7_6"=>$row->sd_7_6,"desa_7_7"=>$row->urlimage1,"desa_7_8"=>$row->urlimage2);
				$i=$i+1;
		}
		
		$response=array("Success"=>"Y","items"=>$arr);
		$final=array("response"=>$response);
}
else
{
$response=array("Success"=>"N","items"=>"null");
$final=array("response"=>$response);
}
		echo json_encode($final);
?>